'''
Created on May 28, 2010

@author: Behrooz Nobakht
'''
from django.http import HttpResponseRedirect
import re

'''
@author: Behrooz Nobakht
'''
class MultipleLoginMiddleware:
    
    def process_request(self, request):
        if re.search("core/login", request.path) is None:
            return None
        if request.user is None:
            return None
        if not request.user.is_authenticated():
            return None
        if request.user.is_authenticated():
            return HttpResponseRedirect("/")
        return None
        
